<template>
	<view>
		<!-- color：主题色 addressList:地址管理数据 @chooseClick：选择事件 @editClick：编辑事件 -->
		<cc-addressSet :addressList="addressList" @chooseClick="chooseClick" @editClick="editClick"></cc-addressSet>

		<view class="save">
			<view class="btn" @tap="addAddress">添加收货地址</view>
		</view>

	</view>
</template>

<script>
	import ccaddressSet from '@/components/cc-addressSet/cc-addressSet.vue'
	export default {
		components: {
			ccaddressSet
		},
		data() {
			return {

				addressList: [{
					name: '小明',
					phone: '12345678915',
					address: '佛山市南海区',
					moreAddres: '桂城街道',
					isdefult: 1,
					id: 1
				}, {
					name: '小红',
					phone: '12345678915',
					address: '广州市海珠区',
					moreAddres: '昌岗路15号',
					isdefult: 0,
					id: 2
				}],

			};
		},


		props: {},

		/**
		 * 生命周期函数--监听页面加载
		 */
		onLoad: function(options) {

		},


		methods: {
			// 编辑地址
			editClick(item) {
				uni.showModal({
					title: '点击编辑条目',
					content: '点击编辑条目' + JSON.stringify(item)
				})
				this.$emit('editorAddress', item)
			},
			chooseClick(item) {

				uni.showModal({
					title: '点击选择条目',
					content: '点击选择条目' + JSON.stringify(item)
				})
			},
			// 增加地址
			addAddress() {
				uni.navigateTo({
					url: '/pages/index/addAddress/addAddress'
				})
			},
		}
	};
</script>
<style lang="scss" scoped>
	.save {
		position: fixed;
		bottom: 0;
		width: 100%;
		height: 120upx;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.save view {
		display: flex;
	}

	.save .btn {

		width: 650rpx;
		height: 82rpx;
		border-radius: 41rpx;
		background: linear-gradient(to bottom, #F9773A, #FF3B06);
		color: #fff;
		justify-content: center;
		align-items: center;
		font-size: 30rpx;
		font-family: PingFang SC-Bold, PingFang SC;
		font-weight: bold;
		color: #FFFFFF;
		line-height: 82rpx;
		margin-bottom: 60px;
	}
</style>